//
//  NSString+CatOut.m
//  沙哈拉FM
//
//  Created by dllo on 15/11/3.
//  Copyright © 2015年 S1mpl3. All rights reserved.
//

#import "NSString+CatOut.h"

@implementation NSString (CatOut)
+(NSString *)getStringOfWorth:(NSString *)string
{
    NSString *str = [NSString stringWithFormat:@"%@",string];
    NSInteger i = 0;
    NSMutableString *str1 = [NSMutableString string];
    
    if (str.length > 5) {
        while (i >= 0 && i <= (str.length - 5)) {
            [str1 appendString:[NSString stringWithFormat:@"%C", [str characterAtIndex:i++]]];
            
        }
        [str1 appendString:[NSString stringWithFormat:@"."]];
        [str1 appendString:[NSString stringWithFormat:@"%C", [str characterAtIndex:i + 1]]];
        [str1 appendString:[NSString stringWithFormat:@"万人"]];
        return str1;
        
    }
    else if(str.length == 5)
    {
        while (i >= 0 && i <= (str.length - 5)) {
            [str1 appendString:[NSString stringWithFormat:@"%C", [str characterAtIndex:i++]]];
            
        }
        [str1 appendString:[NSString stringWithFormat:@"."]];
        [str1 appendString:[NSString stringWithFormat:@"%C", [str characterAtIndex:i + 1]]];
        [str1 appendString:[NSString stringWithFormat:@"万人"]];
        return str1;
        
    }
    else
    {
        
        
        return str;
    }
    
}
@end

